import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class BadgetView extends StatelessWidget {
  final Widget child;
  final String label;
  final bool showBadge;

  const BadgetView({required this.child, required this.label, required this.showBadge});

  @override
  Widget build(BuildContext context) {
    return Stack(
      alignment: Alignment.topRight,
      children: <Widget>[
        child,
        if (showBadge)
          Container(
            decoration: BoxDecoration(
                color: Colors.red,
                borderRadius: BorderRadius.circular(11)
            ),
            width: 16,
            height: 16,
            child: Center(child: Text(label, textAlign: TextAlign.center, style: TextStyle(color: Colors.white,
                fontSize: 7),),),
          )
      ]
    );
  }
}